import { createRouter, createWebHashHistory } from 'vue-router'

import Home from './views/Home.vue'
import Films from './views/Films.vue'
import Film from './views/Film.vue'
import Cinemas from './views/Cinemas.vue'
import Center from './views/Center.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    // 顶层路由如何寻找：引起一整个屏幕发生变化的就是顶级路由
    {
      path: '/',
      component: Home,
      children: [
        {
          path: 'films',
          name: 'films',
          component: Films
        },
        {
          path: 'cinemas',
          name: 'cinemas',
          component: Cinemas
        },
        {
          path: 'center',
          name: 'center',
          component: Center
        },
      ]
    },
    {
      path: '/film/:filmId',
      name: 'film',
      component: Film
    }
  ]
})

export default router
